﻿using Cavy.UdpClient.Serializable;

namespace Cavy.UdpClient
{
    public struct Message_JoinRoomResponse : IMessage
    {
        public int MessageType => (int)MessageTypeEnum.JoinRoomResponse;
        public bool Success;
        
        public void Serialize(NetDataWriter writer)
        {
            writer.Put(Success);
        }

        public void Deserialize(NetDataReader reader)
        {
            Success = reader.GetBool();
        }

        public void AnalysisData(MessageFactory factory, IpEndPoint endPoint)
        {
            var room = factory.As<UdpClient>();
            room.CallOnJoinRoomResponse(this);
        }
    }
}